package com.xopencode.spring.aop;

import org.junit.Test;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;

/**
 * @Auther: Mcb
 * @Date: 2022/3/15 23:46
 * @Description:
 */
public class IOCTest_AOP {

    @Test
    public void test01(){
        AnnotationConfigApplicationContext applicationContext = new AnnotationConfigApplicationContext(MainConfigOfAOP.class);

        //1、不要自己创建对象
		//MathCalculator mathCalculator = new MathCalculator();
		//mathCalculator.div(1, 1);
        MathCalculator mathCalculator = applicationContext.getBean(MathCalculator.class);

        try {
            mathCalculator.b();
            //mathCalculator.b();
        } catch (Exception e) {
            e.printStackTrace();
        }

        applicationContext.close();
    }

}

